<template>
	<view>
		<view class="imgebox" >
			<image  :src="data.user.avatar" mode="aspectFill"></image>
		</view>
		<view class="titlebox">
			<view class="first-title">
				<text class="left">{{data.user.username}}</text>
				<text class="right">薪资：{{data.amount}}元/月</text>
			</view>
			<view class="second-title">
				<text >{{data.workType.workname}}</text>
			</view>
		</view>
		<view class="detailList" v-if="data.profile != null">
			<view class="detailList-title">工作详情</view>
			<view class="detailList-item" v-if="data.address != null">期望地址:{{data.address.provinceName}}{{data.address.cityName}}{{data.address.areaName}}{{data.address.detail}}</view>
			<view class="detailList-item">工作经验:{{data.profile.worktime}}</view>
			<view class="detailList-item" v-if="data.profile.height != ''">身高:{{data.profile.height}}</view>
			<view class="detailList-item" v-if="data.profile.weight != ''">体重:{{data.profile.weight}}</view>

		</view>
		<view class="fiexd-btn" >
			<button @click="doWant(0)">不合适</button>
			<button @click="doWant(1)">合适</button>
		</view>
	
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				id:'',
				data:{}
			}
		},
		onLoad(option){
			this.id = option.id;
			this.jobInfo();
		},
		
		onShow(){
			
		},
		methods: {
		
			doWant(type){
				
				
				console.info("===data==="+JSON.stringify(this.data));
				let param = {
					want:type,
					workType:this.data.worktype,
					jobId:this.data.id,
					uid:this.data.user.id
				}
			
				let that = this;
				console.info("====param==="+JSON.stringify(param));
				this.$api.doUserJob(param).then(res => {
					
					if(res.code == 1){
						that.$util.$showToast(res.msg, '处理成功', 'none');
						uni.navigateBack({
							delta:1
						})
						
					}else{
						that.$util.$showToast(res.msg, '', 'none');
						
					}
					console.info(res)
				})
			},
			join(){
				
				let param = {
					id:this.id,
				}
				let that = this;
				this.$api.want(param).then(res => {
					
					if(res.code == 1){
						that.$util.$showToast("处理成功,客服会联系您", '', 'none');
						// uni.navigateBack({
						// 	delta:1
						// })
					}else{
						that.$util.$showToast(res.msg, '', 'none');
						
					}
					console.info(res)
				})
			},
			
			jobInfo(){
				let param = {
					id:this.id
				}
				let that = this;
				this.$api.jobDetail2(param).then(res => {
					console.info(res)
					if(res.code == 1){
						that.data = res.data;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.imgebox{
		width: 100%;
		height: 370rpx;
		image{
			width: 100%;
			height: 370rpx;
		}
	}
	.fiexd-btn{
	  display: flex;
	  width: 90%;
	  
	}
	.fiexd-btn button{
		  width: 40%;
		  margin: 5%;
	}
	.titlebox{
		border-bottom: 1rpx solid #EBEBEB;
		margin: 42rpx 40rpx;
		height: 151rpx;
		.first-title{
			display: flex;
			.left{
				flex: auto;
				font-size: 34rpx;
				color: #333333;
			}
			.right{
				font-size: 30rpx;
				color: #12ADA9;
			}
		}
		.second-title{
			margin-top: 20rpx;
			text{
				font-size: 22rpx;
				color: #666666;
				padding: 13rpx;
				background: #F5F5F5;
				border-radius: 5rpx;
				margin-right: 20rpx;
			}
		}
	}
	.detailList{
		padding:0 46rpx;
		.detailList-title{
			font-size: 28rpx;
			color: #333333;
			padding-bottom: 20rpx;
		}
		.detailList-item{
			font-size: 24rpx;
			color: #666666;
			line-height: 48rpx;
		}
	}
</style>
